home *** CD-ROM | disk | FTP | other *** search
- /*
- File: 2020Letter.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __2020LETTER__
- #define __2020LETTER__
-
- #ifndef __BLJSTANDARDINCLUDES__
- #include "BLJStandardIncludes.h"
- #endif
-
- #ifndef __LETTER__
- #include "Letter.h"
- #endif
-
- #ifndef __2020RECIPIENT__
- #include "2020Recipient.h"
- #endif
-
- /***********************************|****************************************/
-
- class T2020HalfGateway;
- class TVirtualFile;
- class TVirtualFolder;
- class TRecipientList;
- class TRecipient;
-
- /***********************************|****************************************/
-
- class T2020Letter : public TLetter
- {
- public: T2020Letter ( T2020HalfGateway* halfGateway, long queueID, long sequenceNumber ); // default constructor
- T2020Letter ( T2020HalfGateway* halfGateway, T2020Letter* parentLetter, MailMsgRef mailMsgRef ); // creator for a nested letter
-
- virtual ~T2020Letter();
-
- public:
- virtual Boolean GetLetterID ( BLJLetterID& letterID ) const;
- virtual Boolean GetReplyID ( BLJLetterID& replyID ) const;
- virtual Boolean GetConversationID ( BLJLetterID& conversationID ) const;
-
- virtual Boolean GetSendTimeStamp ( BLJTime& sendTime ) const;
- virtual Boolean GetLetterPriority ( TLetter::LetterPriority& priority ) const;
- virtual Boolean GetSubject ( TRString& subject ) const;
-
- // What type of letter is this?
- virtual Boolean IsLetterAutoForwarded (Boolean& yesItIs) const;
- virtual Boolean IsLetterAutoReply ( Boolean& yesItIs ) const;
- virtual Boolean LetterIsCompleted ( );
-
- // These routines return booleans related to the reports requested about this letter.
- virtual Boolean DeliveryReceiptRequested ( Boolean &yesItIs ) const;
- virtual Boolean NonDeliveryReportRequested ( Boolean& yesItIs ) const;
- virtual Boolean EncloseOriginalLetterInReport ( Boolean &yesItIs ) const;
-
- // What can be done with this letter by the recipient?
- virtual Boolean CanLetterBeAutoForwarded (Boolean& yesItCan) const;
-
- // Get the recipients for this letter
- virtual unsigned short GetRecipientCount ( RecipientTypeSet recipientType ) const;
- virtual TRecipient* GetRecipient (RecipientTypeSet recipientType, unsigned short index) const;
-
- //
- // RECIPIENT REPORTS METHODS
- // =========================
- //
- virtual Boolean GetRecipientStatus(RecipientTypeSet recipientType, unsigned short index, RecipientStatusSet& status) const;
- virtual Boolean SetRecipientStatus(RecipientTypeSet recipientType, unsigned short index, RecipientStatusSet status);
- virtual unsigned short GetUnknownRecipientCount() const;
-
- // These deal with the content of the message
- virtual unsigned long GetContentTypeCount ( ) const;
- virtual OSType GetContentType ( unsigned long i ) const;
-
- virtual unsigned long GetSegmentCount( OSType contentType ) const;
- virtual Boolean GetSegmentData( OSType contentType, unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
- virtual Boolean GetSegmentInfo( OSType contentType, unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
-
- // This call returns information about the enclosures in the letter
- virtual TVirtualFolder* GetEnclosuresFolder() const;
-
- // This call returns another letter which is 'nested' inside of the current letter.
- virtual unsigned short GetNestedLetterCount() const;
- virtual TLetter* GetNestedLetter(unsigned short index) const;
-
- //
- // A 2020 letter (obviously) occupies a chunk of memory and consumes a mailMsfRef. Minimize()
- // will dispose of both the memory usage and close the letter's mailMsfRef.
- //
- virtual void Minimize();
-
- /***********************************|****************************************/
- //
- // OCE LETTER PUBLIC METHODS
- // ============================
- //
- // These methods are specific to the OCELetter object.
- //
- /***********************************|****************************************/
-
- // Return a pointer to the half gateway for this letter.
- T2020HalfGateway * GetHalfGateway ( ) const ;
-
- // Return the OCE mailMsgRef. It this letter is not currently open, then open it first
- // in order to obtain the letterRef; otherwise just return the current mailMsgRef.
- virtual MailMsgRef GetMailMsgRef( ) const;
-
- // Close the letter's OCE mailMsgRef. Also close
- virtual void CloseMailMsgRef( Boolean forceClosed = false ) const;
-
- // Return the number of letters nested 'inside' this letter.
- virtual unsigned long GetLetterNestingLevel ( ) const;
-
- // Is this letter really a OCERecipientReport, which would not be sent but instead use
- // internally to mark the status of pending letter in the OCEHalfGateway.
- virtual Boolean IsLetterAReport ( Boolean& yesItIs ) const;
-
- // These methods are useful only if the letter is a report. GetRecipientReportStatusCount() returns the
- // number of recipients in the report, and GetRecipientReportStatus ( ) return the information for a
- // particular recipient.
- virtual unsigned long GetRecipientReportStatusCount ( ) const;
- virtual Boolean GetRecipientReportStatus ( unsigned long index, unsigned short& recipientIndex, OSErr& status ) const;
-
- //
- // Letter Block access methods. These methods can be used to get any block from the OCE letter
- // in a raw format.
- //
- virtual unsigned short GetLetterBlockCount() const;
- virtual Boolean GetLetterBlockInfo(unsigned short blockIndex, OCECreatorType& blockType, long& offset, long& length) const;
- virtual Boolean GetLetterBlockData(OCECreatorType blockType, unsigned short blockNumber, void* buffer, unsigned long bufferSize, unsigned long startOffsetWithinBlock, unsigned long& returnedDataSize) const;
-
- virtual Boolean MarkRecipient (T2020Recipient *recipient);
-
- // Debugging methods
- virtual ostream& DescribeSubclass(ostream& ) const;
- virtual ostream& operator >> ( ostream& ) const;
-
- static Boolean ForceUnusedAOCELettersClosed ( unsigned long howMany );
-
- protected:
-
- // Get the list of recipients of the given type from the 20/20 letter, and make a
- // T2020Recipient for each of them. Put each T2020Recipient into a list, and then
- // return that list. This should be used to set up the f[To,Cc,Bcc]Recipients
- // lists in this object. Use the MakeResolvedRecipientTypeList to handle resolved recipients.
- void MakeRecipientLists ();
- void InitializeRecipients ();
- void InitializeAttributes ( ) ;
- Boolean InitializeLetterStandardContentFields ( );
- Boolean InitializeLetterImageContentFields ( );
-
- virtual Boolean GetStandardContentSegmentData ( unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
- virtual Boolean GetStandardContentSegmentInfo ( unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
-
- virtual Boolean GetImageContentSegmentData( unsigned long index, unsigned long offset,void *data, long& maximumDataSize ) const;
- virtual Boolean GetImageContentSegmentInfo( unsigned long index, BLJLetterBlockType& blockType, long& blockLength ) const;
-
- protected:
-
- Boolean GetNthTableOfContentItem(unsigned short n, OSType& type, long& offset, long& length) const;
- void SetNthTableOfContentItem(unsigned short n, OSType type, unsigned long offset, unsigned long length);
-
- T2020HalfGateway* fHalfGateway;
- long fQueueID; // only used for non-nested top level letter, == 0 for nested letter
- long fLetterSequenceNumber; // only used for non-nested top level letter, == 0 for nested letter
-
- T2020Letter* fParentLetter; // only used for nested letter, == nil if non nested letter
- MailMsgRef fLetterRefNum; // if == 0, letter is not currently open.
- Boolean fActivelyBeingUsed; // true if someone is 'using' the fLetterRefNum
-
- T2020Letter* fNestedLetter;
-
- Boolean fCachedAttributesInitialized;
-
- MailIndications fLetterIndications;
- TRecipientList* fRecipients[ bccRecipient - fromRecipient + 1 ];
-
- // Generic letter content fields
- unsigned short fContentTypesCount;
- OSType fContentTypes [ 2 ];
-
- // Standard letter content fields
- Boolean fStandardContentInfoHasBeenInitialized;
- unsigned short fNumberOfTOCItems;
- TVirtualFile* fTableOfContents;
- TVirtualFile* fContent;
-
- // Image content fields
- Boolean fContentImageInfoHasBeenInitialized;
- unsigned long fContentImagePageCount;
- unsigned long * fContentImagePageOffsets;
-
- // Enclosures fields
- Boolean fEnclosuresFolderInitialized;
- TVirtualFolder* fEnclosuresFolder;
-
- // Fields for letters which are 'reports'
- Handle fRecipientReportH; // Only used if letter is a report.
- unsigned long fRecipientReportCount;
-
- MailBlockInfo** fLetterBlockInfoListH; // Table-of-Contents list information
- };
-
- /***********************************|****************************************/
-
- inline T2020HalfGateway * T2020Letter::GetHalfGateway () const
- {
- return fHalfGateway;
- }
-
- /***********************************|****************************************/
-
- #endif // __2020LETTER__
-